// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package action.paiement;

import java.io.IOException;
import java.sql.*;
import java.util.Calendar;
import java.util.Properties;
import java.util.ResourceBundle;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.*;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.*;

public class LogicWebRetourPaiementExterieur extends Action
{

    private static Log logger = LogFactory.getLog(LogicWebRetourPaiementExterieur.class);

	public ActionForward execute( ActionMapping pMapping, ActionForm pForm, HttpServletRequest pRequest, HttpServletResponse pResponse)
	{
		return null;
		
	}
    
    
    
    public ActionForward executer(ActionMapping actionmapping, ActionForm actionform, HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse)
        throws ServletException, IOException
    {
    	logger .debug("bienvenue dans LogicWebRetourPaiementExterieur");
		ResourceBundle properties = ResourceBundle.getBundle("ressources");
        HttpSession httpsession = httpservletrequest.getSession(false);
        logger.debug((new StringBuilder()).append("serveur de retour : ").append(httpservletrequest.getSession().getServletContext().getRealPath("/")).append(" --- ref_etu = ").append(httpservletrequest.getParameter(properties.getString("paiement.cleRetour"))).toString());
        if(httpsession == null || httpsession.getAttribute("beanEtudiant") == null)
        {
            httpservletrequest.setAttribute("beanErreurMetier", "Perte des informations de l'\351tudiant");
            return actionmapping.findForward("erreur");
        }
        if(httpservletrequest.getQueryString() == null)
        {
            httpservletrequest.setAttribute("beanErreurMetier", "Absence de param\350tres dans l'URL de retour du site de paiement.");
            return actionmapping.findForward("erreur");
        }
        String s = httpservletrequest.getParameter(properties.getString("paiement.cleAutorisation"));
        String s1 = "success";
        if(s == null)
            s1 = traitePaiementRefuse(httpservletrequest);
        else
        if(s.equals(""))
            s1 = traitePaiementRefuse(httpservletrequest);
        else
        {
        	s1 = traitePaiementAccepte(httpservletrequest);
            logger.debug( (new StringBuilder()).append("dans execute(),avant le forward sur retour = ").append(s1).toString());
            httpservletrequest.setAttribute("autorisation", httpservletrequest.getParameter(properties.getString("paiement.cleAutorisation")));
        }
        return actionmapping.findForward(s1);
    }

    private String traitePaiementAccepte(HttpServletRequest httpservletrequest)
    {
        HttpSession httpsession;
        String s;
        Connection connection;
        httpsession = httpservletrequest.getSession(false);
        logger.debug("Dans traitePaiementAccepte");
		ResourceBundle properties = ResourceBundle.getBundle("fr.parisouest.paiement.ApogeeBundle");
        s = httpservletrequest.getParameter(properties.getString("paiement.cleRetour"));
        connection = null;
        Object obj = null;
        Object obj1 = null;
        String s1 = "";
        Object obj2 = null;

        logger.debug("juste avant le return");
        return "success";
    }

    private String traitePaiementRefuse(HttpServletRequest httpservletrequest)
    {
        HttpSession httpsession = httpservletrequest.getSession(false);
		ResourceBundle properties = ResourceBundle.getBundle("fr.parisouest.paiement.ApogeeBundle");
        String s = httpservletrequest.getParameter(properties.getString("paiement.cleRetour"));
        String s1 = "success";
        //BeanEtudiant beanetudiant = null;
        return s1;
    }

    private static final String NOM_CLASSE_COMPLET = LogicWebRetourPaiementExterieur.class.getName();
    private static final String NCC = NOM_CLASSE_COMPLET;
    private static final String NOM_CLASSE = NOM_CLASSE_COMPLET.substring(NOM_CLASSE_COMPLET.lastIndexOf('.') + 1);

}
